<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>Document</title>
  <script>
    var fYear,fMonth,fDate,fTime;
    window.onload=function(){
        fYear = document.getElementById('fYear');
        fMonth = document.getElementById('fMonth');
        fDate = document.getElementById('fDate');
        fTime = document.getElementById('fTime');
        timeMove();
    }
    function timeMove(){
        date = new Date();
        fYear.innerHTML = date.getFullYear();	//获取年份
        fMonth.innerHTML = date.getMonth()+1; 	//获取月份，0～11，所以必须加1
        fDate.innerHTML = date.getDate();    	//获取日期
        fTime.innerHTML = date.getHours()+":"+date.getMinutes()+":"+date. getSeconds();
        setInterval(timeMove,1000);     			//每秒调用一次
    }
  </script>
 </head>
 <body>
  <font id='fYear'></font>年<font id='fMonth'></font>月<font id='fDate'> </font>日&nbsp;<font id='fTime'></font>
 </body>
</html>

